package com.songcan.gateway.exception;

import org.springframework.cloud.gateway.support.NotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException;

public class RouteException extends ResponseStatusException {

    public RouteException(String message) {
        this(HttpStatus.OK, message);
    }

    public RouteException(String message, Throwable cause) {
        this(HttpStatus.OK, message, cause);
    }

    private RouteException(HttpStatus httpStatus, String message) {
        super(httpStatus, message);
    }

    private RouteException(HttpStatus httpStatus, String message, Throwable cause) {
        super(httpStatus, message, cause);
    }

    public static RouteException create(boolean with404, String message) {
        HttpStatus httpStatus = HttpStatus.OK;
        return new RouteException(httpStatus, message);
    }

    public static RouteException create(boolean with404, String message,
                                           Throwable cause) {
        HttpStatus httpStatus = HttpStatus.OK;
        return new RouteException(httpStatus, message, cause);
    }
}
